import RequestUtils from '@/utils/RequestUtils'

export default {
  /**
   * 新增
   * @param params
   * @returns {AxiosPromise}
   */
  add(params = {}) {
    return RequestUtils({
      url: `/accounting/accountingAp`,
      method: 'POST',
      data: {
        ...params
      }
    })
  },
  /**
   * 批量删除（多个用逗号隔开）
   * @param ids
   * @returns {AxiosPromise}
   */
  remove(ids) {
    return RequestUtils({
      url: `/accounting/accountingAp/${ids}`,
      method: 'DELETE'
    })
  },
  genAutoAps(ids) {
    return RequestUtils({
      url: `/accounting/accountingAp/genAutoAps/${ids}`,
     method: 'POST',
    
    })
  },
  /**
   * 修改
   * @param params
   * @returns {AxiosPromise}
   */
  edit(params = {}) {
    return RequestUtils({
      url: `/accounting/accountingAp`,
      method: 'PUT',
      data: {
        ...params
      }
    })
  },
  /**
   * 详情
   * @param id
   * @returns {AxiosPromise}
   */
  get(id) {
    return RequestUtils({
      url: `/accounting/accountingAp/${id}`,
      method: 'GET'
    })
  },
  /**
   * 列表
   * @param params
   * @returns {AxiosPromise}
   */
  list(params = {}) {
    return RequestUtils({
      url: `/accounting/accountingAp/search`,
      method: 'POST',
      data: {
        ...params
      }
    })
  },

  /**
   * SKU列表
   * @param params
   * @returns {AxiosPromise}
   */
  findSkuAll(params = {}, page) {
    return RequestUtils({
      url: `/accounting/accountingAp/findSkuAll/${page.current}/${page.pageSize}`,
      method: 'POST',
      data: {
        ...params
      }
    })
  },
  /**
   * 列表-分页
   * @param params
   * @returns {AxiosPromise}
   */
  page(params = {}, page) {
    return RequestUtils({
      url: `/accounting/accountingAp/search/${page.current}/${page.pageSize}`,
      method: 'POST',
      data: {
        ...params
      }
    })
  },
  /**
   * 列表字段汇总
   * @param params
   * @returns {AxiosPromise}
   */
  sum(params = {}) {
    return RequestUtils({
      url: `/accounting/accountingAp/sum`,
      method: 'POST',
      data: {
        ...params
      }
    })
  },
  returnSum(params = {}) {
    return RequestUtils({
      url: `/accounting/accountingAp/returnSum`,
      method: 'POST',
      data: {
        ...params
      }
    })
  },

  /**
   * 结算清单报表汇总
   * @param params
   * @returns {AxiosPromise}
   */
settlementViewMonthlySum(params = {}) {
    return RequestUtils({
      url: `/accounting/accountingAp/settlementViewMonthlySum`,
      method: 'POST',
      data: {
        ...params
      }
    })
  },
  settlementViewMonthlyReturnSum(params = {}) {
      return RequestUtils({
        url: `/accounting/accountingAp/settlementViewMonthlyReturnSum`,
        method: 'POST',
        data: {
          ...params
        }
      })
    },

/**
   * 结算清单sku报表
   * @param params
   * @returns {AxiosPromise}
   */
  settlementViewSkuMonthly(params = {}, page) {
    return RequestUtils({
      url: `/accounting/accountingAp/settlementViewSkuMonthly/${page.current}/${page.pageSize}`,
      method: 'POST',
      data: {
        ...params
      }
    })
  },
 /**
   * 结算清单报表
   * @param params
   * @returns {AxiosPromise}
   */
  settlementViewMonthly(params = {}, page) {
    return RequestUtils({
      url: `/accounting/accountingAp/settlementViewMonthly/${page.current}/${page.pageSize}`,
      method: 'POST',
      data: {
        ...params
      }
    })
  },
  /**
   * 供应商汇总列表-分页
   * @param params
   * @returns {AxiosPromise}
   */
  supplierSumPage(params = {}, page) {
    return RequestUtils({
      url: `/accounting/accountingAp/supplierSumPage/${page.current}/${page.pageSize}`,
      method: 'POST',
      data: {
        ...params
      }
    })
  },
  skuReport(params = {}, page) {
    return RequestUtils({
      url: `/accounting/accountingAp/skuReport/${page.current}/${page.pageSize}`,
      method: 'POST',
      data: {
        ...params
      }
    })
  },
  skuChartReport(params = {}, page) {
    return RequestUtils({
      url: `/accounting/accountingAp/skuChartReport/${page.current}/${page.pageSize}`,
      method: 'POST',
      data: {
        ...params
      }
    })
  },
  settleAgain(id) {
    return RequestUtils({
      url: `/accounting/accountingAp/settleAgain/${id}`,
      method: 'post'
    })
  },
 batchProcessFix() {
    return RequestUtils({
      url: `/accounting/accountingAp/fixDataThree`,
      method: 'post'
    })
  },
  batchProcessFixRtAmt() {
     return RequestUtils({
       url: `/accounting/accountingAp/fixDataFour`,
       method: 'post'
     })
   },

 handleConfirmPay(id) {
    return RequestUtils({
      url: `/accounting/accountingAp/handleConfirmPay/${id}`,
      method: 'post'
    })
  },
  fixDataTwo() {
    return RequestUtils({
      url: `/accounting/accountingAp/fixDataTwo`,
      method: 'post'
    })
  },
  fixData() {
    return RequestUtils({
      url: `/accounting/accountingAp/fixData`,
      method: 'post'
    })
  },
  generateHistoricArAp() {
    return RequestUtils({
      url: `/accounting/accountingAp/generateMigrationArAp`,
      method: 'post'
    })
  },
  editPrice(params) {
    if (!params) params = {}
     return RequestUtils({
       url: `/accounting/accountingAp/editPrice`,
       method: 'post',
       data: {
         ...params
       }
     })
    },
  generateArAp() {
    return RequestUtils({
      url: `/accounting/accountingAp/generateArAp`,
      method: 'post'
    })
  },
  regenerateArAp() {
    return RequestUtils({
      url: `/accounting/accountingAp/regenerateArAp`,
      method: 'post'
    })
  },
  batchGenerateHistoricArAp(ids) {
    return RequestUtils({
      url: `/accounting/accountingAp/batchGenerateHistoricArAp/${ids}`,
      method: 'post'
    })
  },
  batchGenerateArAp(ids) {
    return RequestUtils({
      url: `/accounting/accountingAp/batchGenerateArAp/${ids}`,
      method: 'post'
    })
  },
  processReturn() {
    return RequestUtils({
      url: `/accounting/accountingAp/processReturn`,
      method: 'post'
    })
  },
  reprocessReturn() {
    return RequestUtils({
      url: `/accounting/accountingAp/reprocessReturn`,
      method: 'post'
    })
  },
  batchProcessReturn(ids) {
    return RequestUtils({
      url: `/accounting/accountingAp/batchProcessReturn/${ids}`,
      method: 'post'
    })
  },
  /**
   * 品牌排行视图
   * @param params
   * @returns {AxiosPromise}
   */
  brandRateView(params = {}, page) {
    return RequestUtils({
      url: `/accounting/accountingAp/brandRateView/${page.current}/${page.pageSize}`,
      method: 'POST',
      data: {
        ...params
      }
    })
  },
  exportreportData(params = {}, page) {
    return RequestUtils({
      url: `/accounting/accountingAp/exportreportData`,
      method: 'POST',
      data: {
        ...params
      }
    })
  },
  /**
   * 供应商排行视图
   * @param params
   * @returns {AxiosPromise}
   */
  supplierRateView(params = {}, page) {
    return RequestUtils({
      url: `/accounting/accountingAp/supplierRateView/${page.current}/${page.pageSize}`,
      method: 'POST',
      data: {
        ...params
      }
    })
  },

  /**
   * 导出
   * @param params
   * @returns {AxiosPromise}
   */
  exportData(params = {}) {
    return RequestUtils({
      url: `/accounting/accountingAp/exportData`,
      method: 'POST',
      data: {
        ...params
      }
    })
  }
}
